package com.qf.ssm.mapper;

import com.qf.ssm.pojo.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface RoleMapper {

    @Select("select * from role r where r.id in (select role_id from user_role ur where ur.user_id =#{uid} )")
    List<Role> findRoleByUserId(Long uid) ;

    @Insert("INSERT INTO role(name,remark,status)values(#{name},#{remark},#{status})")
    void addRole(Role role);

    @Update("UPDATE role SET name=#{name} WHERE status=#{status} ")
    void updateRole(Role role);

    @Delete("UPDATE role set name='0'&&name='1' WHERE id in")
    void deleteRoleByIds(@Param("ids")List<Long>ids);
}
